-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requires version constraints #517
Conversation
Give this a try instead so we don't have to handle the regex logic: from packaging.requirements import Requirement
from packaging.version import Version
req = Requirement("name>1")
if Version(system.version) in req.specifier:
#Valid Version |
brewtils/plugin.py
Outdated
) | ||
) | ||
if valid_versions: | ||
system_candidates = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mapping back and forth from str(Version)
to system.version
doesn't always match because Version parsing will sometimes fix formatting issues so it is no longer a one to one Mapping. Check out how System Client handles it in _determine_latest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this situation is slightly different. I think changing an invalid requires version to a valid package version is ok. If a version can't be parsed at all it should fail. Anyway, I updated tests to show what happens in the various cases. We can debate more.
brewtils/plugin.py
Outdated
|
||
if valid_versions: | ||
system_candidates = [ | ||
system for system in systems if system.version in valid_versions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should compare parsed versions to parsed versions:
system for system in systems if str(Version(system.version)) in valid_versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
complete
No description provided.